<?php if(empty($mascotas)):?>
<h1>No existe datos todavia</h1>
<?php else:?>
<div class="grid_12">
<div class="box">
	<div class="header">
		<img src="img/icons/packs/fugue/16x16/shadeless/table-excel.png" width="16" height="16">
	<h3>Usuarios</h3><span></span>
	</div>
</div>
<div class="content">
	<table class="table" id="table-example">
	<thead>
		<tr>
		<th>Num. Tatuaje</th>
		<th>Nombre</th>
		<th>Raza</th>
		<th>Propietario</th>
		<th>Cod. CHIP</th>
   		<th>Acciones</th>
	    </tr>
	</thead>
	<tbody>
	<?php foreach($mascotas as $m):?>
	<?php $id = $m['Mascota']['id']; ?>
<tr>
	<td><?php echo $m['Mascota']['num_tatuaje']; ?></td>
	<td><?php echo $m['Mascota']['nombre']; ?></td>
	
	<td><?php echo $m['Raza']['nombre']; ?></td>
   	
	<td>
    <?php
    if($m['Duenosmascota'] == null){
        echo $m['Criadero']['nombre'];
    }else{
       foreach($duenos as $dueno){
        if($dueno != null){
            if($dueno['estado'] == 1)
               echo $dueno['Propietario']['nombre'];
        }
       } 
    }
        
    ?>
    </td>
	
	<td><?php echo $m['Mascota']['chip']; ?></td>	
   <td>
      <?php echo $this->Html->link('Editar', array('action'=>'editar', $id)); ?>
   </td>
</tr>
<?php endforeach; ?>
	</tbody>   
	</table>
	
</div>
</div>
<?php endif;?>
<div class="grid_4">
			<div id="blocks" class="box tabbed">
		 		<div class="header">
				<h3>Acciones</h3>
				</div>
				<div class="content">
					<ul id="block-list-icons" class="block-list with-icon tab-content">
						<li class="i-16-calendar">Lista de Mascotas</li>
						<li class="i-16-application"><?php echo $this->Html->link('Registrar Nueva Mascota',array('controller'=>'Mascotas','action'=>'insertar'))?></li>
						<li class="i-16-drive">Imprimir</li>
						<li class="i-16-chart">Reportes</li>
						<li class="i-16-balloon">Lorem ipsum</li>
					</ul>
				</div> <!-- End of .content -->
				</div> <!-- End of .box -->
</div> <!-- End of .grid_4 -->
<div class="clear"></div>	
</div>

<script defer>
			$(window).load(function() {
				$('#table-example').dataTable();
				$(window).resize();
			});
</script>